#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int mx = 0;

  map<string, int> mp;
  
  for (int i = 0; i < n - k + 1; i++) {
    string t = s.substr(i, k);
    mp[t]++;
    mx = max(mx, mp[t]);
  }

  cout << mx << endl;
  for (auto p : mp) {
    if (p.second == mx) {
      cout << p.first << " ";
    }
  }
  return 0;
}
